﻿from subprocess import *
import logging
import re
log_file = 'father.log'
log_level = logging.DEBUG
logging.basicConfig(filename=log_file, level=log_level)
logger = logging.getLogger()
p=Popen(["gnugo-3.7.12","--mode","gtp"],shell=True,stdin=PIPE,stdout=PIPE)
#p=Popen(["pachi"],shell=True,stdin=PIPE,stdout=PIPE,stderr=PIPE)
p.stdin.write('genmove white\n'.encode('GBK'))

#while not succeeded:
lines = p.stdout.readline()
logger.debug(lines)
#lines = p.stdout.readline()
#logger.debug(lines)
#for line in lines:
#	logger.debug(line)
#while True:
#	None
